/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.editparts;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.swt.graphics.Color;

import edu.pku.sei.modeler.figures.MetaClassFigure;
import edu.pku.sei.modeler.images.ImageProvider;
import edu.pku.sei.modeler.model.structure.MetaShapeElement;
import edu.pku.sei.modeler.util.ResourceFactory;

/**
 * @author zl
 *
 */
public class MetaRelationshipEditpart extends MetaClassEditPart {
//	public static final Color RELATIONSHIP_COLOR = new Color(null,80,215,230);
	public static final Color RELATIONSHIP_COLOR = new Color(null,255,255,255);
	public MetaRelationshipEditpart(MetaShapeElement model) {
		super(model);
	}
	
	@Override
	protected IFigure createFigure() {
		IFigure figure = super.createFigure();
		Label header = (Label)((MetaClassFigure)figure).getHeader();
		header.setFont(ResourceFactory.getHeadFont());
		return figure;
	}
	
	protected void refreshVisuals() {
		super.refreshVisuals();
		Label header = (Label)((MetaClassFigure)getFigure()).getHeader();
		header.setIcon(ImageProvider.getImage(ImageProvider.RELATION_IMAGE));
		figure.setBackgroundColor(RELATIONSHIP_COLOR);
	}
}
